﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    /*输入一行字符串，分别统计出其中英文字母、数字、空格的个数。*/
    class Program1
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入一行字符串");
            string readStr = Console.ReadLine();
            int countLetter = 0;
            int countDigit = 0;
            int countSpace = 0;
            foreach (char c in readStr)
            {
                if (char.IsUpper(c) || char.IsLower(c))
                {
                    countLetter++;
                }
                else if (char.IsDigit(c))
                {
                    countDigit++;
                }
                else if (char.IsWhiteSpace(c))
                {
                    countSpace++;
                }
            }
            Console.WriteLine("英文字母出现了{0}次，数字出现了{1}次，空格出现了{2}次",countLetter,countDigit,countSpace);
            Console.ReadKey();

        }
    }
}
